package com.qiangesoft.blog.controller.manage;

import com.qiangesoft.blog.common.annotation.OperationLog;
import com.qiangesoft.blog.common.mvc.PageQuery;
import com.qiangesoft.blog.common.mvc.PageResultVO;
import com.qiangesoft.blog.common.result.ResponseResult;
import com.qiangesoft.blog.system.entity.SysOperationLog;
import com.qiangesoft.blog.system.service.ISysOperationLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 操作日志 前端控制器
 * </p>
 *
 * @author qiange
 */
@RestController
@RequestMapping("/system/operationLog")
@RequiredArgsConstructor
@Api(tags = "操作日志管理")
public class SysOperationLogController {

    private final ISysOperationLogService operationLogService;

    @GetMapping(value = "/list")
    @ApiOperation(value = "操作日志列表")
    public PageResultVO<SysOperationLog> list(@Validated PageQuery pageQuery, String operation) {
        return operationLogService.listLog(pageQuery, operation);
    }

    @DeleteMapping(value = "/delete")
    @OperationLog(value = "删除操作日志")
    @ApiOperation(value = "删除操作日志")
    public ResponseResult delete(@RequestBody List<Long> ids) {
        return operationLogService.deleteLog(ids);
    }
}

